package javaDemo;


import java.util.ArrayList;
import java.util.LinkedList;

public class Demo {

    public static void main(String[] args) {
       /* int[] arr = new int[3];
        arr[0]=1;
        arr[1]=2;
        arr[2]=3;
        System.out.println(arr);//[I@4554617c

        int[] arr2 = arr;
        arr2[0]=11;
        arr2[1]=21;
        arr2[2]=31;

        System.out.println(arr2);//[I@4554617c
        System.out.println(arr[2]);

        int[] arr3 = {1,2,3};
        System.out.println(arr3);//[I@74a14482
        System.out.println(arr3[2]);*/


        ArrayList<String> list = new ArrayList<String>();
        for (int i=0;i<1000;i++){
            list.add(i+"");
        }

        long begin = System.currentTimeMillis();
        for (String s : list){
            System.out.println(s);
        }
        long end = System.currentTimeMillis();



        LinkedList linkedList = new LinkedList();
        for (int i=0;i<1000;i++){
            linkedList.add(i+"");
        }


        long beginLink = System.currentTimeMillis();
        for (Object s : linkedList){
            System.out.println(s);
        }
        long endLink = System.currentTimeMillis();
        System.out.println("11111:"+(end-begin));
        System.out.println("2222:"+(endLink-beginLink));
    }
}
